package com.atguigu.yygh.cmn.excel;

import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelReader;
import com.alibaba.excel.read.metadata.ReadSheet;
import com.atguigu.yygh.cmn.bean.Student;

/*==========================================
      时 间:   2022-04-16
      讲 师:   刘  辉
      描 述:   尚硅谷教学团队
 ==========================================*/
public class ExcelReadDemo {

    public static void main(String[] args) {
       // EasyExcel.read("C:\\Users\\LH\\Desktop\\hello.xlsx", Student.class,new StudentListener()).sheet(1).doRead();

        ExcelReader excelReader = EasyExcel.read("C:\\Users\\LH\\Desktop\\hello.xlsx", Student.class, new StudentListener()).build();
        ReadSheet readSheet = EasyExcel.readSheet(0).build();
        ReadSheet readSheet2 = EasyExcel.readSheet(1).build();
        excelReader.read(readSheet);
        excelReader.read(readSheet2);
        // 这里千万别忘记关闭，读的时候会创建临时文件，到时磁盘会崩的
        excelReader.finish();
    }
}
